<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    let arr1=[2,6,9,8,7,5,1]
    let max=arr1[0];
    let min=arr1[0];
    let maxIndex=0;
    let minIndex=0;

  for(let i=0;i<arr1.length;i++){
      
      if(max<arr1[i])
      {
          max=arr1[i];
          maxIndex=i;
      }
  }
  for(let index=0;index<arr1.length;index++){
      
      if(min>arr1[index])
      {
          min=arr1[index];
          minIndex=index;
      }
  }
  console.log(max)
  console.log(maxIndex)
  console.log(min)
  console.log(minIndex)

</script>
<script>
    str1='';
    str2='';
    let names=["卡卡西","佐助","鸣人","大蛇丸","雏田","小苏","凤姐","黑崎一护"];
    for(let index=0;index<names.length-1;index++){
        str1+=(names[index])+"|";   
     
  }
  console.log(str1)
  str2=str1+names[7];
  console.log(str2)
</script>
<script>
    let num=[0,2,3,0,5,6,0,7,8]
    let num1=[];
    for(let i=0;i<num.length;i++){
    
        if(num[i]!=0)
        {
            num1.push(num[i]);
        }
      
        
    }
    console.log(num1)
</script>
<script>
       let num3 = [22,20,30,10,7,6]
    for(let i=0;i<parseInt(num3.length/2);i++){
        let temp = num3[num3.length-1-i];
        num3[num3.length-1-i] = num3[i];
        num3[i] = temp;
    }
    console.log(num3)


</script>

</html>